////////////////////////////////////////////////////////////////////////////////
//
//  FLYING KIWI BV
//  Copyright 2010 Flying Kiwi BV
//  All Rights Reserved.
//
//  NOTICE: Flying Kiwi permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package plantool.display.windows.objects {
	//--------------------------------------------------------------------------
	//  Imports
	//--------------------------------------------------------------------------
	import plantool.core.CoreDisplayObject;
	import plantool.display.windows.BaseWindow;
	
	//--------------------------------------------------------------------------
	//  [Metadata (Events, Style, Effects etc)]
	//--------------------------------------------------------------------------
	
	//--------------------------------------------------------------------------
	//  Class declaration
	//--------------------------------------------------------------------------
	public class BaseWindowObject extends CoreDisplayObject {
		//--------------------------------------------------------------------------
		//Class constants
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//Class variables
		//--------------------------------------------------------------------------
		private var _window:BaseWindow		= null;
		private var _width:Number			= 0;
		private var _height:Number			= 0;
		
		//--------------------------------------------------------------------------
		//Class properties
		//--------------------------------------------------------------------------
		protected function get window():BaseWindow { return _window; }
		
		override public function get height():Number 			{ return _height; }
		override public function set height(value:Number):void 	{ _height = value; invalidate(); }
		override public function get width():Number 			{ return _width; }
		override public function set width(value:Number):void 	{ _width = value; invalidate(); }
		
		//--------------------------------------------------------------------------
		//Constructor and Destructor
		//--------------------------------------------------------------------------
		public function BaseWindowObject(window:BaseWindow) {
			super();
			
			_window = window;
		}
		
		public override function dispose():void {
			//remove reference to window, but do not dispose it. window will dispose itself
			_window = null;
			
			//super dispose
			super.dispose();
		}
		
		//--------------------------------------------------------------------------
		//Class methods
		//--------------------------------------------------------------------------
		protected override function init():void {
			invalidate();
		}
	}
}